package lium.lbs.lbsim.adapter

import android.graphics.Rect
import android.os.Build
import android.widget.AbsListView
import android.widget.ImageView
import android.widget.TextView
import com.abbott.mutiimgloader.util.JImageLoader
import com.abbott.mutiimgloader.weixin.WeixinMerge
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.qmuiteam.qmui.widget.QMUIRadiusImageView
import kotlinx.android.synthetic.main.activity_group_rqcode.*
import lium.lbs.lbsim.App
import lium.lbs.lbsim.R
import lium.lbs.lbsim.activity.MainActivity
import lium.lbs.lbsim.bean.GlistBean
import lium.lbs.lbsim.jgchat.utils.photovideo.takevideo.utils.LogUtils
import lium.lbs.lbsim.zfw.SearchForGourpActivity

class SearchForGourpAdapter : BaseQuickAdapter<GlistBean, BaseViewHolder>(R.layout.item_contact_list) {
    override fun convert(helper: BaseViewHolder?, item: GlistBean?) {

        helper?.getView<TextView>(R.id.contacts_name)?.text = item?.name + ""
        /* JImageLoader(App.getContext())!!.displayImages(
             item?.headImg,
             helper?.getView<ImageView>(R.id.contacts_head),
             WeixinMerge()
         )*/
        var mainActivity: SearchForGourpActivity? = null
        mainActivity = mContext as SearchForGourpActivity?


        helper?.getView<TextView>(R.id.contacts_code)?.text = item?.gid.toString() + ""
        if (item?.headImg!!.size >1){
            try {
                var imageLoader = JImageLoader(App.getContext())
                imageLoader!!.displayImages(item?.headImg, helper?.getView<ImageView>(R.id.contacts_head), WeixinMerge())
            } catch (e: NoSuchFieldException) {
                e.printStackTrace()
            } catch (e: IllegalArgumentException) {
                e.printStackTrace()
            } catch (e: IllegalAccessException) {
                e.printStackTrace()
            }catch (e: IllegalStateException) {
                e.printStackTrace()
            }
        } else{
            mainActivity?.displayImage(item?.headImg.get(0),R.drawable.touxianggroup,helper!!.getView<QMUIRadiusImageView>(R.id.contacts_head))
        }


    }

}


